package edu.indiana.d2i.ontology.exec;

import com.hp.hpl.jena.ontology.OntModel;

import edu.indiana.d2i.ontology.util.AccessDBUtil;
import edu.indiana.d2i.ontology.util.Constants;

public class TreeSample extends PInfo {
	private final String prefix = "treesample_";
	private final String SQLPREFIX = "select * from P_INFO where ID=";

	public TreeSample(AccessDBUtil dbCon, OntModel model, int id, String subjectURI) {
		super(dbCon, model, id, subjectURI);
		resourceURI = nameSpace + prefix + id; 			// set the URI for the resource
		sqlStatement = SQLPREFIX + id;					// 
		individual = 									// create individual (instance)
			model.getOntClass(Constants.TREE_SAMPLE_CLASS).createIndividual(resourceURI);
	}
	
	@Override
	protected void addDataProperties(String sql) {		
		super.addDataProperties(sql);
		
		String sqlStatement = "SELECT * FROM f_organ fo where fo.id=" + organID;
		super.addDataProperties(sqlStatement);
	}

	@Override
	protected void addObjectProperties(String subjectURI) {
		super.addObjectProperties(subjectURI);
	}
	
	@Override
	public void setData2JenaModel() {
		assert sqlStatement != null;
		
		// add data properties				
		this.addDataProperties(sqlStatement);
		
		// add object properties
		this.addObjectProperties(subjectURI);
	}
}
